using System;
using UnityEngine;
namespace DefaultNamespace
{
    public class TestOverlapCapsule : MonoBehaviour
    {
        [Header("检测盒子的半径")]
        public int ColliderV3;
    
        void Update()
        {
            //模拟的盒子中心点，x、y、z轴长度的一半
            Collider[] collider = Physics.OverlapCapsule(gameObject.transform.position, gameObject.transform.position+new Vector3(0,1,0)
                ,3,LayerMask.GetMask("Enemy"));

            foreach (var col in collider)
            {
                Debug.Log("检测到的游戏对象："+col);
            }
        }

        private void OnDrawGizmos()
        {
            Mesh mesh = GetComponent<MeshFilter>().mesh;
            Gizmos.color = Color.green;
            Gizmos.DrawWireMesh(mesh, Vector3.zero, Quaternion.identity, Vector3.one);
        }
    }
}